package com.tangly.codeing.controller;

import com.tangly.codeing.utils.PageInfo;
import com.tangly.codeing.utils.ReturnT;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * BaseController
 *
 * @author tangbing
 * @date 2019/4/29
 */
public abstract class BaseController {
    /**
     * 校验参数非空
     * @param pageInfo 分页工具类
     * @return 返回工具类
     */
    ReturnT<Object> validateParam(@RequestBody PageInfo pageInfo) {
        if (pageInfo == null) {
            return new ReturnT<>(ReturnT.FAIL_CODE, "参数pageInfo不存在");
        }
        if (pageInfo.getWhereMap() == null) {
            return new ReturnT<>(ReturnT.FAIL_CODE, "参数whereMap不存在");
        }
        return null;
    }
}
